import toml
from pathlib import Path
from loguru import logger

BASE_DIR = Path(__file__).resolve().parent.parent

# 加载项目配置
with open(BASE_DIR / 'conf/config.toml', 'r') as config_file:
    config = toml.load(config_file)

# 设置常用目录

LOG_DIR = BASE_DIR / 'log'
LOG_DIR.mkdir(parents=True, exist_ok=True)

# 配置日志
logger.add(LOG_DIR / 'sys.log', rotation="1 day", format="{time} {level} {message}", level="INFO")



